{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from main import chat_with_pdf, print_stream_and_return_full_answer\n",
    "from dotenv import load_dotenv\n",
    "\n",
    "load_dotenv()\n",
    "\n",
    "bert_paper_url = \"https://arxiv.org/pdf/1810.04805.pdf\"\n",
    "questions = [\n",
    "    \"what is BERT?\",\n",
    "    \"what NLP tasks does it perform well?\",\n",
    "    \"is BERT suitable for NER?\",\n",
    "    \"is it better than GPT\",\n",
    "    \"when was GPT come up?\",\n",
    "    \"when was BERT come up?\",\n",
    "    \"so about same time?\",\n",
    "]\n",
    "\n",
    "history = []\n",
    "for q in questions:\n",
    "    stream, context = chat_with_pdf(q, bert_paper_url, history)\n",
    "    print(\"User: \" + q, flush=True)\n",
    "    print(\"Bot: \", end=\"\", flush=True)\n",
    "    answer = print_stream_and_return_full_answer(stream)\n",
    "    history = history + [\n",
    "        {\"role\": \"user\", \"content\": q},\n",
    "        {\"role\": \"assistant\", \"content\": answer},\n",
    "    ]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "pfsdk",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.17"
  },
  "stage": "development"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
